Skip to content

NMEA AIS Decoder Driver#215

Open
BillBrown341 wants to merge 17 commits into
opensensorhub:masterfrom
Botts-Innovative-Research:34-ais-shipxplorer-driver
Open

NMEA AIS Decoder Driver#215
BillBrown341 wants to merge 17 commits into
opensensorhub:masterfrom
Botts-Innovative-Research:34-ais-shipxplorer-driver

Conversation

@BillBrown341
Copy link
Copy Markdown
Contributor

The purpose of this driver is to decode NMEA AIS messages from a source (UDP, Serial, etc) and translate them into AIS Reports.

@BillBrown341
Copy link
Copy Markdown
Contributor Author

Coordinating with Jim to field test driver week of 6/1/2026

@BillBrown341
Copy link
Copy Markdown
Contributor Author

6/2/2026 - Jim and I tested driver at his place and everything worked as intended.

developer {
id 'BillBrown341'
name 'Bill Brown'
organization 'Botts-inc'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to GeoRobotix + in the osgi manifest

@@ -0,0 +1,87 @@
package org.sensorhub.impl.sensor.nmeaais;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add license header to files

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NmeaAisHandler.java, NmeaAisOutputRawMessages.java, NmeaAisOutputPositionClassB.java, NmeaAisOutputStaticDataClassB.java, NmeaAisOutputAidNavigation.java, MessageIdDescriptions.java, and NmeaAisReportInterface.java are all missing them!

.definition(SWEHelper.getPropertyUri("DimStarboard")))
.addField("epfd", sweFactory.createQuantity()
.label("Type of EPFD")
.description("0 = undefined, 1 = GPS, 2 = GLONASS, 3 = Combined GPS/GLONASS, 4 = Loran-C, 5 = Chayka, 6 = Integrated navigation system, 7 = Surveyed, 8 = Galileo, 15 = internal GNSS")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than creating a quantity, you could do a category.

dataRecord.addComponent("epfd", fac.createCategory()
.definition(SWEHelper.getPropertyUri("EPFDType"))
.label("EPFD Type")
.description("description of what EPFD is .....")
.addAllowedValues(
"undefined",
"GPS",
"GLONASS",
"GPS/GLONASS",
"Loran-C",
"Chayka",
"Integrated",
"Surveyed",
"Galileo",
"Internal GNSS")
.build());
then when publishing the data just map the integer code to the string using a switch case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you could do that with a few of these fields if u wanted to display the type rather than a quantity make it a catagory

osgi {
manifest {
attributes ('Bundle-Vendor': 'Botts Inc')
attributes ('Bundle-Activator': 'org.sensorhub.impl.sensor.aisshipxplorer.Activator')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bundle activator points to a different package that doesn't exist in this driver

'Bundle-Activator': 'org.sensorhub.impl.sensor.aisshipxplorer.Activator'

Should be:
'Bundle-Activator': 'org.sensorhub.impl.sensor.nmeaais.Activator'

.label(OUTPUT_LABEL)
.description(OUTPUT_DESCRIPTION)
.definition(OUTPUT_DEFINITION)
.addField("messageId", sweFactory.createQuantity()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the sampleTime field

.label("Class B Unit Flag")
.description("0 = Class B SOTDMA unit; 1 = Class B CS unit")
.definition(SWEHelper.getPropertyUri("UnitFlag")))
.addField("displayFlag", sweFactory.createQuantity()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like this could be a boolean, ur saying either yes it has it or no it is not equipped. yes/no 0/1 boolean

.label("Type of EPFD")
.description("Electronic position fixing device type (type 19 only)")
.definition(SWEHelper.getPropertyUri("Epfd")))
.addField("dte", sweFactory.createQuantity()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boolean is available / is not available

.description(OUTPUT_DESCRIPTION)
.definition(OUTPUT_DEFINITION)
.addField("messageId", sweFactory.createQuantity()
.label("Message Id")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest creating a NmeaAisHelper, there are several duplicated fields across the output classes. This would help reduce repetitiveness and ensure consistency across ur output structure.

You can put the file in the helpers directory

public class NmeaAisHelper extends GeoPosHelper {
public static final String AIS_URI_BASE = "http://sensorml.com/ont/swe/property/ais/";

public Count createMessageId() {
      return createCount()
          .description("")
          .definition(AIS_URI_BASE + "MessageId")
          .label("Message Id");
  }

// fill in the rest
}

this would make ur outputs cleaner too

public void doInit() {
NmeaAisHelper fac = new NmeaAisHelper();
aisReportRecord = fac.createRecord()
.name(OUTPUT_NAME)
.label(OUTPUT_LABEL)
.description(OUTPUT_DESCRIPTION)
.definition(OUTPUT_DEFINITION)
.addField("sampleTime", fac.createTime().asSamplingTimeIsoUTC())
.addField("messageId", fac.createMessageId())
}

dataBlock.setIntValue(25, report.getDimStarboard());
dataBlock.setIntValue(26, report.getPosType());
dataBlock.setIntValue(27, report.getDte());
dataBlock.setIntValue(28, report.getModeFlag());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u set getModeFlag twice in the output

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index 16 and 28

@@ -0,0 +1,7 @@
package org.sensorhub.impl.sensor.nmeaais.outputs;
import dk.dma.ais.message.AisMessage;
import dk.dma.ais.message.AisPositionMessage;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean up imports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShipXplorer AIS Driver Development

3 participants